using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using System.Reflection;
using System.ComponentModel.Design.Serialization;
using System.CodeDom;
using GuavaData;
using System.Drawing.Design;

namespace GuavaLib
{
    [Serializable]
    public class GDataGridViewColumn : DataGridViewColumn, Guava
    {
        GuavaData.Domain.Domain d;
        string gname = null;

        public GDataGridViewColumn() : base()
        {
            this.CellTemplate = new System.Windows.Forms.DataGridViewTextBoxCell();
            return;
        }

        public GDataGridViewColumn(DataGridViewCell dgvc)
            : base(dgvc)
        {
            this.CellTemplate = new System.Windows.Forms.DataGridViewTextBoxCell();
            return;
        }

        #region Guava Members

        [Browsable(false)]
        public LaunchType LType
        {
            get { return LaunchType.NA; }
        }

        [Browsable(false)]
        public ControlType CType
        {
            get { return ControlType.Attribute; }
        }

        [Browsable(false)]
        public string GText
        {
            get { return null; }
        }

        public string GName
        {
            get
            {
                if (this.gname == null)
                    return this.HeaderText;
                else
                    return this.gname;
            }
            set
            {
                this.gname = value;
            }
        }

        [Browsable(false)]
        public System.Drawing.Point GLocation
        {
            get { return new System.Drawing.Point(); }
        }

        [Browsable(false)]
        public System.Drawing.Size GSize
        {
            get { return new System.Drawing.Size(); }
        }

        [Browsable(false)]
        public List<Guava> GComponents
        {
            get { return new List<Guava>(); }
        }

        public void GBind(string table, int i)
        {
            return;
        }

        public string GDefault
        {
            get { return null; }
        }

        [Browsable(false)]
        public string GToolTip
        {
            get { return null; }
        }

        public GuavaData.Domain.Domain GDomain
        {
            get
            {
                if (this.d == null)
                    this.d = new GuavaData.Domain.String();
                return this.d;
            }
            set
            {
                this.d = value;
                this.CellTemplate = d.GridCellTemplate;
            }
        }

        public Guava this[string s]
        {
            get { return null; }
        }

        #endregion

        public override string ToString()
        {
            return String.Concat(this.HeaderText, ": ", this.d.ToString());
        }
    }
}
